<?php 
/**
*/
$this->load->view('header', $template);
?>
<link rel="stylesheet" href="<?php echo base_url() ?>assets/css/home.css">
<!-- ---------------------------------------------------------- -->

<section>
	<div class="wrapper">

		<div id="tabs">
			<span class="documents select">Tài liệu (<?php echo count((array)$listBook) ?>)</span>
			<span class="tags">Từ khóa (<?php echo count((array)$listTags) ?>)</span>
			<span class="local">Địa điểm (<?php echo count((array)$listLocal) ?>)</span>
		</div>
		<ul class="list list-books">
		<?php foreach ($listBook as $book) { ?>
				<?php 
					$this->load->helper('bookaccess'); 
					$cover = getCover($book->id_document);
					if($cover == '') {
						$letter = substr($book->name_document, 0, 1);
						$cover = base_url() . 'assets/img/cover/cover'.$letter.'.jpg';
					}
				?>
				<li>
					<img class="cover" src="<?php echo $cover; ?>" alt="">
					<div class="info">
						<h3><a href="<?php echo base_url().'book/info/'.$book->id_document ?>">
							<?php echo $book->name_document; ?>
						<a></h3>
						<p class="category"><i class="fa fa-briefcase"></i> <?php echo $book->name_cat; ?></p>
						<p class="description">Tóm tắt: "<?php echo $book->description ?>"</p>
					</div>					
				</li>
		<?php } ?>
		</ul>

		<ul class="list list-tags">
		<?php foreach ($listTags as $tag) { ?>
				<?php 
					$this->load->helper('bookaccess'); 
					$cover = getCover($tag['id_document']);
					if($cover == '') {
						$letter = substr($tag['name_document'], 0, 1);
						$cover = base_url() . 'assets/img/cover/cover'.$letter.'.jpg';
					}
				?>
				<li>
					<img class="cover" src="<?php echo $cover; ?>" alt="">
					<div class="info">
						<h3 style="font-weight: 400">
							<a href="<?php echo base_url().'book/read/'.$tag['id_doc'].'/'.$tag['id_chap'].'?tag='.$tag['id_tags'] ?>">
							<?php echo $tag['name_document']; ?>
						</a></h3>
						<p class="category"> 
							<i class="fa fa-briefcase"></i> <?php echo $tag['name_cat']; ?> - 
							<i class="fa fa-bookmark"></i> <?php echo $tag['name_chap']; ?>
						</p>
						<p class="discription">"<?php echo $tag['name_tags'] ?>"</p>
					</div>					
				</li>
		<?php } ?>
		</ul>

		<ul class="list list-local">
		<?php foreach ($listLocal as $tag) { ?>
				<?php 
					$this->load->helper('bookaccess'); 
					$cover = getCover($tag['id_document']);
					if($cover == '') {
						$letter = substr($tag['name_document'], 0, 1);
						$cover = base_url() . 'assets/img/cover/cover'.$letter.'.jpg';
					}
				?>
				<li>
					<img class="cover" src="<?php echo $cover; ?>" alt="">
					<div class="info">
						<h3 style="font-weight: 400">
							<a href="<?php echo base_url().'book/read/'.$tag['id_doc'].'/'.$tag['id_chap'].'?tag='.$tag['id_tags'] ?>">
							<?php echo $tag['name_document']; ?>
						</a></h3>
						<p class="category"> 
							<i class="fa fa-briefcase"></i> <?php echo $tag['name_cat']; ?> - 
							<i class="fa fa-bookmark"></i> <?php echo $tag['name_chap']; ?> -
							<i class="fa fa-crosshairs"></i> <?php echo $tag['type_location'].' '.$tag['name_location']; ?>
						</p>
						<p class="discription">"<?php echo $tag['name_tags'] ?>"</p>
					</div>					
				</li>
		<?php } ?>
		</ul>
	</div>
</section>

<script type="text/javascript" src="<?php echo base_url() ?>/assets/js/search.js">
 <?php 
$this->load->view('footer');
  ?>